Repository navigation
fix(io): return a file slot without spawning from a stream's drop - #157
Merged
Merged
Conversation
Dropping a stream that held a registered file slot spawned a task to give the slot back. A compio runtime being dropped clears its executor by dropping every unfinished task's future, so a stream owned by such a task spawned onto the queue being drained, tripping compio-executor's `inner.map.is_empty()` assertion. The task that takes the slot now keeps it: it waits for the stream to go and gives the slot back then, and dropping the stream only wakes it. A keeper dropped with its runtime leaves the slot to the ring's teardown.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A compio stream that held a registered file slot gave it back by spawning a task from
File::drop. When a runtime drops, compio clears its queue by dropping each unfinished task's future. A stream dropped that way spawned into the queue being cleared, and compio-executor'sinner.map.is_empty()assertion fired.The task that installs the slot now keeps it for the stream's whole life. Dropping the stream marks it gone and wakes that task, which returns the slot, so drop no longer spawns. While the runtime runs, slots are still always returned. If the runtime drops first, the slot goes with the ring. Zero-copy sends are unchanged: compio keeps a cancelled op's buffers until the kernel completes it.
The new test
a_runtime_drops_while_a_task_holds_a_stream_with_a_slotfails on main with that assertion and passes with this change. On Linux the io and h1 suites pass. zenwave's compionative_backend_testspassed 19 of 19 against this branch, where main fails 12 at the same assertion.Closes #156